package com.cnpc.rightslogan.utils.common;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@RequestMapping("base")
@Api("BaseController相关的api")
@ApiIgnore
@Slf4j
public class BaseController {

    private static final Integer PAGENUM = 1;       //分页页码 默认第1页
    private static final Integer PAGESIZE = 10;     //分页页长 默认10条

    @ApiIgnore
    @ResponseBody
    @GetMapping("/404.do")
    public String error404Page() {
        log.info("error404Page");
        return "404页面";
    }

    @ApiIgnore
    @ResponseBody
    @GetMapping("/500.do")
    public String error500Page() {
        log.info("error500Page");
        return "500页面";
    }

//    @ApiOperation(httpMethod = "GET", value = "404测试", notes = "404测试")
//    @RequestMapping(value = "/get404", method = RequestMethod.GET)
//    public ModelAndView get404() {
//        logger.info("lalalala404");
//        ModelAndView modelAndView = new ModelAndView();
//        modelAndView.setViewName("user/index");
//        return modelAndView;
//    }
//
//    @ResponseBody
//    @ApiOperation(httpMethod = "GET", value = "500测试", notes = "500测试")
//    @RequestMapping(value = "/get500", method = RequestMethod.GET)
//    public String get500() {
//        logger.info("lalalala500");
//        int i = 10 / 0;
//        return "index.jsp";
//    }
//
//    @RequestMapping("/hello")
//    public String hello(String name) {
//        return "hi " + name;
//    }
//
//    @RequestMapping("/timeout")
//    public String timeout() {
//        try {
//            //睡5秒，网关Hystrix3秒超时，会触发熔断降级操作
//            Thread.sleep(5000);
//        } catch (exception e) {
//            e.printStackTrace();
//        }
//        return "timeout1";
//    }
}
